home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vbeyes10
/
eyes.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
6KB
|
215 lines
VERSION 2.00
Begin Form eyes
BackColor = &H00FFFFFF&
BorderStyle = 0 'None
Caption = "Eyes"
ClientHeight = 2610
ClientLeft = 1530
ClientTop = 1560
ClientWidth = 2760
ClipControls = 0 'False
ControlBox = 0 'False
DrawStyle = 5 'Transparent
Height = 3015
Icon = EYES.FRX:0000
Left = 1470
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 174
ScaleMode = 3 'Pixel
ScaleWidth = 184
Top = 1215
Width = 2880
WindowState = 1 'Minimized
Begin PictureBox Picture9
AutoSize = -1 'True
Height = 510
Left = 1920
Picture = EYES.FRX:0302
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 8
Top = 1800
Width = 510
End
Begin PictureBox Picture8
AutoSize = -1 'True
Height = 510
Left = 1080
Picture = EYES.FRX:0604
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 7
Top = 1800
Width = 510
End
Begin PictureBox Picture7
AutoSize = -1 'True
Height = 510
Left = 240
Picture = EYES.FRX:0906
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 6
Top = 1800
Width = 510
End
Begin PictureBox Picture6
AutoSize = -1 'True
Height = 510
Left = 1920
Picture = EYES.FRX:0C08
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 5
Top = 1080
Width = 510
End
Begin PictureBox Picture5
AutoSize = -1 'True
Height = 510
Left = 1080
Picture = EYES.FRX:0F0A
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 4
Top = 1080
Width = 510
End
Begin PictureBox Picture4
AutoSize = -1 'True
Height = 510
Left = 240
Picture = EYES.FRX:120C
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 3
Top = 1080
Width = 510
End
Begin PictureBox Picture3
AutoSize = -1 'True
Height = 510
Left = 1920
Picture = EYES.FRX:150E
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 2
Top = 360
Width = 510
End
Begin PictureBox Picture2
AutoSize = -1 'True
Height = 510
Left = 1080
Picture = EYES.FRX:1810
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 1
Top = 360
Width = 510
End
Begin PictureBox Picture1
AutoSize = -1 'True
Height = 510
Left = 240
Picture = EYES.FRX:1B12
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 0
Top = 360
Width = 510
End
End
' Global Variable Used to Determine Cursor Position's Sector
Dim Sector As Integer
Sub Form_Load ()
'Hide the Normal Form Off the Screen Boundaries
Eyes.Move -(Eyes.Width + 5), -(Eyes.Height + 5)
End Sub
Sub Form_Resize ()
'Declare Cursor Structure & OldSector
Dim Cursor As lpoint
Dim OldSector As Integer
' Quit Program if Not Iconic
If Eyes.WindowState <> 1 Then End
' If Iconic State
Do While Eyes.WindowState = 1
'Get the Current Cursor Position
Call GetCursorPos(Cursor)
'Save the Last Sector Number
OldSector = Sector
'Determine the New Sector Number
Call GetSector(Cursor.x, Cursor.y)
' Skip Icon Paint if Same Sector as Before
If OldSector = Sector Then GoTo Skipit
' Update Icon with New Sector Picture
Select Case Sector
Case 1
Eyes.Icon = Picture1.Picture
Case 2
Eyes.Icon = Picture2.Picture
Case 3
Eyes.Icon = Picture3.Picture
Case 4
Eyes.Icon = Picture4.Picture
Case 5
Eyes.Icon = Picture5.Picture
Case 6
Eyes.Icon = Picture6.Picture
Case 7
Eyes.Icon = Picture7.Picture
Case 8
Eyes.Icon = Picture8.Picture
Case 9
Eyes.Icon = Picture9.Picture
End Select
Skipit:
'Return Processing Back to Windows
Tmp = DoEvents()
Loop
End Sub
'
' This Subroutine determines the sector number associated with the cursor position
' There are 9 possible sectors, number 5 being the icon itself
'
' +----+----+----+
' | 01 | 02 | 03 |
' +----+----+----+
' | 04 |icon| 06 |
' +----+----+----+
' | 07 | 08 | 09 |
' +----+----+----+
'
Sub GetSector (x As Integer, y As Integer)
' Declare Icon Structure
Dim Irect As lrect
'Find Size of Icon
Call GetWindowRect(Eyes.hWnd, Irect)
'Find X Sector
Sector = 1
If (x >= Irect.Left) And (x < Irect.Right) Then Sector = 2
If x >= Irect.Right Then Sector = 3
'Find Y Sector
If (y >= Irect.Top) And (y < Irect.Bottom) Then Sector = Sector + 3
If y >= Irect.Bottom Then Sector = Sector + 6
End Sub